fix some cargo_compile tests
authorAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 20 May 2016 13:22:58 +0000 (16:22 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 20 May 2016 13:22:58 +0000 (16:22 +0300)
tests/test_cargo_compile.rs
tests/test_cargo_compile_custom_build.rs
tests/test_cargo_compile_plugins.rs

index 2e318790b46a54a1399c3ed1127ed7f3541f3ec4..c177f4da3047a234e689e0ddbdbd80ad8199d2f1 100644 (file)
@@ -267,6 +267,7 @@ test!(cargo_compile_with_warnings_in_the_root_package {
     assert_that(p.cargo_process("build"),
         execs()
         .with_stderr("\
+[COMPILING] foo [..]
 src[..]foo.rs:1:14: 1:26 warning: function is never used: `dead`, \
     #[warn(dead_code)] on by default
 src[..]foo.rs:1 fn main() {} fn dead() {}
@@ -314,16 +315,13 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
         "#);
 
     assert_that(p.cargo_process("build"),
-        execs()
-        .with_stderr(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
-                              [COMPILING] foo v0.5.0 ({})\n",
-                             p.url(),
-                             p.url()))
-        .with_stderr("\
+        execs().with_stderr(&format!("\
+[COMPILING] bar v0.5.0 ({url}/bar)
 [..]warning: function is never used: `dead`[..]
-[..]fn dead() {}
+[..]fn dead() {{}}
 [..]^~~~~~~~~~~~
-"));
+[COMPILING] foo v0.5.0 ({url})
+", url = p.url())));
 
     assert_that(&p.bin("foo"), existing_file());
 
@@ -888,6 +886,7 @@ test!(unused_keys {
                 execs().with_status(0)
                        .with_stderr("\
 warning: unused manifest key: project.bulid
+[COMPILING] foo [..]
 "));
 
     let mut p = project("bar");
@@ -911,6 +910,7 @@ warning: unused manifest key: project.bulid
                 execs().with_status(0)
                        .with_stderr("\
 warning: unused manifest key: lib.build
+[COMPILING] foo [..]
 "));
 });
 
index d78a23a29e62cd2433fd62dd89b0711382a2cf94..8dce9f08deb913aa9d6bf9507fcb28aac5ffaf30 100644 (file)
@@ -32,13 +32,10 @@ test!(custom_build_script_failed {
 [COMPILING] foo v0.5.0 ({url})
 [RUNNING] `rustc build.rs --crate-name build_script_build --crate-type bin [..]`
 [RUNNING] `[..]build-script-build[..]`
-",
-url = p.url()))
-                       .with_stderr(&format!("\
-[ERROR] failed to run custom build command for `foo v0.5.0 ({})`
+[ERROR] failed to run custom build command for `foo v0.5.0 ({url})`
 Process didn't exit successfully: `[..]build[..]build-script-build[..]` \
     (exit code: 101)",
-p.url())));
+url = p.url())));
 });
 
 test!(custom_build_env_vars {
@@ -133,7 +130,7 @@ test!(custom_build_script_wrong_rustc_flags {
 
     assert_that(p.cargo_process("build"),
                 execs().with_status(101)
-                       .with_stderr(&format!("\
+                       .with_stderr_contains(&format!("\
 [ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ({})`: \
 `-aaa -bbb`",
 p.url())));
@@ -679,7 +676,7 @@ test!(build_deps_not_for_normal {
 
     assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
                 execs().with_status(101)
-                       .with_stderr("\
+                       .with_stderr_contains("\
 [..]lib.rs[..] error: can't find crate for `aaaaa`[..]
 [..]lib.rs[..] extern crate aaaaa;
 [..]           ^~~~~~~~~~~~~~~~~~~
@@ -819,11 +816,13 @@ test!(output_separate_lines {
         "#);
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(101)
-                       .with_stderr("\
+                       .with_stderr_contains("\
 [COMPILING] foo v0.5.0 (file://[..])
 [RUNNING] `rustc build.rs [..]`
 [RUNNING] `[..]foo-[..]build-script-build[..]`
 [RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
+[ERROR] could not find native static library [..]
+[ERROR] Could not compile [..]
 "));
 });
 
@@ -845,11 +844,13 @@ test!(output_separate_lines_new {
         "#);
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(101)
-                       .with_stderr("\
+                       .with_stderr_contains("\
 [COMPILING] foo v0.5.0 (file://[..])
 [RUNNING] `rustc build.rs [..]`
 [RUNNING] `[..]foo-[..]build-script-build[..]`
 [RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
+[ERROR] could not find native static library [..]
+[ERROR] Could not compile [..]
 "));
 });
 
index 655de4d16ca34b0d55ae479e76098725a8f282ed..afaf83cced7309dee750899f89b8bccb2c44f775 100644 (file)
@@ -262,8 +262,9 @@ test!(native_plugin_dependency_with_custom_ar_linker {
 
     foo.build();
     assert_that(bar.cargo_process("build").arg("--verbose"),
-                execs().with_stderr("\
+                execs().with_stderr_contains("\
 [COMPILING] foo v0.0.1 ([..])
 [RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
+[ERROR] could not exec the linker [..]
 "));
 });